public class Gongyueshu {
     public static void main(String[] args) {
        int m = 1000;
        int n = 495;
        int temp = 0;
        int temp2 = 0;
        if(m>n) temp2=n;
        else temp2=m;
        for(int i = 1; i < temp2; i++) {
          if(m%i==0) {
            if(n%i==0) {
              temp = i;
            }
          }
        }
        System.out.printf("最大公约数是%d。%n",temp);
     }
}
